package it.stasbranger.myproject.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import org.codehaus.jackson.annotate.JsonIgnore;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllSupplierss", query = "select mySuppliers from Suppliers mySuppliers"),
		@NamedQuery(name = "findSuppliersByAddress", query = "select mySuppliers from Suppliers mySuppliers where mySuppliers.address = ?1"),
		@NamedQuery(name = "findSuppliersByAddressContaining", query = "select mySuppliers from Suppliers mySuppliers where mySuppliers.address like ?1"),
		@NamedQuery(name = "findSuppliersByIdsuppliers", query = "select mySuppliers from Suppliers mySuppliers where mySuppliers.idsuppliers = ?1"),
		@NamedQuery(name = "findSuppliersByName", query = "select mySuppliers from Suppliers mySuppliers where mySuppliers.name = ?1"),
		@NamedQuery(name = "findSuppliersByNameContaining", query = "select mySuppliers from Suppliers mySuppliers where mySuppliers.name like ?1"),
		@NamedQuery(name = "findSuppliersByPrimaryKey", query = "select mySuppliers from Suppliers mySuppliers where mySuppliers.idsuppliers = ?1") })
@Table(catalog = "mydb", name = "suppliers")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "MyProject/it/stasbranger/myproject/domain", name = "Suppliers")
@XmlRootElement(namespace = "MyProject/it/stasbranger/myproject/domain")
public class Suppliers implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "idsuppliers", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer idsuppliers;
	/**
	 */

	@Column(name = "name", length = 45)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String name;
	/**
	 */

	@Column(name = "address", length = 45)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String address;

	/**
	 */
	@OneToMany(mappedBy = "suppliers", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
	@XmlElement(name = "", namespace = "")
	java.util.Set<it.stasbranger.myproject.domain.SuppliersHasRequests> suppliersHasRequestses;

	/**
	 */
	public void setIdsuppliers(Integer idsuppliers) {
		this.idsuppliers = idsuppliers;
	}

	/**
	 */
	public Integer getIdsuppliers() {
		return this.idsuppliers;
	}

	/**
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 */
	public String getName() {
		return this.name;
	}

	/**
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 */
	public String getAddress() {
		return this.address;
	}

	/**
	 */
	public void setSuppliersHasRequestses(Set<SuppliersHasRequests> suppliersHasRequestses) {
		this.suppliersHasRequestses = suppliersHasRequestses;
	}

	/**
	 */
	@JsonIgnore
	public Set<SuppliersHasRequests> getSuppliersHasRequestses() {
		if (suppliersHasRequestses == null) {
			suppliersHasRequestses = new java.util.LinkedHashSet<it.stasbranger.myproject.domain.SuppliersHasRequests>();
		}
		return suppliersHasRequestses;
	}

	/**
	 */
	public Suppliers() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Suppliers that) {
		setIdsuppliers(that.getIdsuppliers());
		setName(that.getName());
		setAddress(that.getAddress());
		setSuppliersHasRequestses(new java.util.LinkedHashSet<it.stasbranger.myproject.domain.SuppliersHasRequests>(that.getSuppliersHasRequestses()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("idsuppliers=[").append(idsuppliers).append("] ");
		buffer.append("name=[").append(name).append("] ");
		buffer.append("address=[").append(address).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((idsuppliers == null) ? 0 : idsuppliers.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Suppliers))
			return false;
		Suppliers equalCheck = (Suppliers) obj;
		if ((idsuppliers == null && equalCheck.idsuppliers != null) || (idsuppliers != null && equalCheck.idsuppliers == null))
			return false;
		if (idsuppliers != null && !idsuppliers.equals(equalCheck.idsuppliers))
			return false;
		return true;
	}
}
